<?php

use \Welcomescreen\Agavi\View;

class Frontend_DeliverUploadSuccessView extends View\FrontendBaseView {
	
	/**
	 * @parameter  \AgaviRequestDataHolder $rd
	 * @return     mixed
	 */
	public function executeResource(\AgaviRequestDataHolder $rd) {
		$filePath = $this->getAttribute('filePath');
		$finfo = finfo_open(FILEINFO_MIME_TYPE);
		$mimeType = finfo_file($finfo, $filePath);
		finfo_close($finfo);
		
		$this->getResponse()->setHttpHeader('Content-Type', $mimeType);
		return fopen($filePath, 'r');
	}
}

?>